package com.devilvan.betrice.opgg.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author Evad.Wu
 * @Description OPGG-英雄位置-英雄克制信息 映射
 * @date 2022-10-04
 */
@Setter
@Getter
@ToString(exclude = {"opggChampionPositionPo"})
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "OPGG_POSITION_COUNTER")

@Entity
@Table(name = "OPGG_POSITION_COUNTER")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "OPGG-英雄位置-英雄克制信息 映射")
public class OpggPositionCounterPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 4259791822670801548L;
    @Schema(description = "HEADER的ID")
    @TableField(value = "HID")
    @Column(name = "HID", columnDefinition = "BIGINT(19) NOT NULL COMMENT 'HEADER的ID'")
    private Long hid;
    @Schema(description = "Counter英雄ID")
    @TableField(value = "CHAMPION_ID")
    @Column(name = "CHAMPION_ID", columnDefinition = "BIGINT(19) NOT NULL COMMENT 'Counter英雄ID'")
    private Long championId;
    @Schema(description = "对局数")
    @TableField(value = "PLAY")
    @Column(name = "PLAY", columnDefinition = "INT(10) COMMENT '对局数'")
    private Integer play;
    @Schema(description = "胜利数")
    @TableField(value = "WIN")
    @Column(name = "WIN", columnDefinition = "INT(10) COMMENT '胜利数'")
    private Integer win;
    @Schema(description = "胜率")
    @TableField(value = "WIN_RATE")
    @Column(name = "WIN_RATE", columnDefinition = "DECIMAL(12) COMMENT '胜率'")
    private BigDecimal winRate;

    @Schema(description = "英雄位置信息")
    @ManyToOne(targetEntity = OpggChampionPositionPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumns(value = {
            @JoinColumn(name = "HID", referencedColumnName = "HID", insertable = false, updatable = false),
            @JoinColumn(name = "CHAMPION_ID", referencedColumnName = "CHAMPION_ID", insertable = false, updatable = false)
    })
    private OpggChampionPositionPo opggChampionPositionPo;
}
